<template>
    <div class="header" @click="showDetail = true">
        <div class="content-wrapper">
          <div class="avatar">
            <img :src="seller.avatar" alt="">
          </div> 
          <div class="content">
            <div class="title">
                <span class="brand"></span>
                <span class="name">Ro9nin面馆</span>
            </div>
            <div class="description">{{seller.description}}/预计{{seller.deliveryTime}}分钟送达</div>
            <div class="support" v-if="seller.supports">
                <SupportIcon :type="seller.supports && seller.supports[0].type" size='1' />
                <span class="text">{{seller.supports && seller.supports[0].description}}</span>
            </div>
          </div>
          <div class="support-count" v-if="seller.supports">
            <span class="count">{{seller.supports.length}}个</span>
            <i class="iconfont icon-arrow-right-copy-copy-copy"></i>
          </div>
        </div>
        <div class="bulletion-wrapper">
         <span class="bulletion-title"></span> 
         <span class="bulletion-text">{{seller.bulletin}}</span>    
         <i class="iconfont icon-arrow-right-copy-copy-copy"></i>  
        </div>
        <div class="bg" :data-url="bg"></div>
        <!-- detail -->
        <HeaderDetail v-show="showDetail" @hide="handle"/>
    </div>
</template>

<script setup>
import SupportIcon from '@/components/support-icon/Index.vue'
import { computed, ref } from 'vue'
import HeaderDetail from '@/components/header-detail/Index.vue'

const props = defineProps({
    seller:{
        type: Object,
        default: () =>{}
    }
})
const bg = computed(() => `url(${props.seller.avatar})`)

let showDetail = ref(false)

const handle = (e) =>{
    showDetail.value = e.target
}
</script>

<style lang="less" scoped>
@import '@/assets/variable.less';
@import '@/assets/mixin.less';

.header{
    color: @color-white;
    position: relative;
    background-color: @color-background-ss;

    .content-wrapper{
        display: flex;
        padding: 24px 12px 18px 24px;
        position: relative;
        .avatar{
            width: 64px;
            height: 64px;
            border-radius: 2px;
            overflow: hidden;

            img{
                width: 100%;
            }
        }

        .content{
            flex: 1;
            margin-left: 16px;

            .title{
                margin-bottom: 8px;
                display: flex;
                .brand{
                    width: 30px;
                    height: 18px;
                    display: inline-block;
                    // background-image: url(./brand@2x.png);
                    .bg-image('brand');
                    background-size: 100% 100%;
                }
                .name{
                    @fontsize-large: 16px;
                    margin-left: 6px;
                    font-weight: bold
                }
            }
            .description{
                font-size:@fontsize-small;
                margin-bottom: 8px;

            }
            .support{
                display: flex;
                align-items: center;

                .text{
                    font-size: @fontsize-small-s;
                    margin-left: 4px;
                }
            }
        }
        .support-count{
            position: absolute;
            right:12px;
            bottom: 14px;
            height: 24px;
            line-height: 24px;
            background-color: @color-background-sss;
            border-radius: 5px;
            padding: 0 8px;
            display: flex;
            align-items: center;
            .count{
                font-size: @fontsize-small-s;
            }
            .iconfont{
                font-size: @fontsize-small-s;
                margin-left: 2px;
            }
        }
    }
    .bulletion-wrapper{
        display: flex;
        align-items: center;
        height: 28px;
        padding: 0 8px;
        background-color: @color-background-sss;
        .bulletion-title{
            flex:0 0 22px;
            height: 12px;
            .bg-image('bulletin');
            background-size: 100% 100%;
        }
        .bulletion-text{
            flex: 1;
            margin-left: 4px;
            font-size: @fontsize-small-s;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .icon-arrow-right-copy-copy-copy{
            flex: 0 0 10px;
            font-size: 8px;
        }
    }
    .bg{
        position: absolute;
        top:0;
        right: 0;
        bottom: 0;
        left: 0;
        background: v-bind(bg);
        background-size: 100% 100%;
        z-index:-1;
        filter:blur(5px)    
    }
}

</style>